<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="业务员名称" prop="salesmanName">
        <el-input
          v-model="queryParams.salesmanName"
          placeholder="请输入业务员名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="结算月" prop="settlementMonth">
        <el-input
          v-model="queryParams.settlementMonth"
          placeholder="请输入结算月"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业绩金额" prop="payAmount">
        <el-input
          v-model="queryParams.payAmount"
          placeholder="请输入业绩金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="结算租金" prop="rentPaid">
        <el-input
          v-model="queryParams.rentPaid"
          placeholder="请输入结算租金"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他物流费" prop="otherLogisticsExpense">
        <el-input
          v-model="queryParams.otherLogisticsExpense"
          placeholder="请输入收取其他物流费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他维修费" prop="otherRepairExpense">
        <el-input
          v-model="queryParams.otherRepairExpense"
          placeholder="请输入收取其他维修费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他其他费用" prop="otherExpense">
        <el-input
          v-model="queryParams.otherExpense"
          placeholder="请输入收取其他其他费用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他电线" prop="otherWireExpense">
        <el-input
          v-model="queryParams.otherWireExpense"
          placeholder="请输入收取其他电线"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他水管" prop="otherWaterPipeExpense">
        <el-input
          v-model="queryParams.otherWaterPipeExpense"
          placeholder="请输入收取其他水管"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他主板" prop="otherMotherboardExpense">
        <el-input
          v-model="queryParams.otherMotherboardExpense"
          placeholder="请输入收取其他主板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他相序板" prop="otherPlateExpense">
        <el-input
          v-model="queryParams.otherPlateExpense"
          placeholder="请输入收取其他相序板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他压缩机" prop="otherCompressorExpense">
        <el-input
          v-model="queryParams.otherCompressorExpense"
          placeholder="请输入收取其他压缩机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他人工费" prop="otherPeopleExpense">
        <el-input
          v-model="queryParams.otherPeopleExpense"
          placeholder="请输入收取其他人工费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他设备外观损坏" prop="otherEquipmentExpense">
        <el-input
          v-model="queryParams.otherEquipmentExpense"
          placeholder="请输入收取其他设备外观损坏"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收取其他叉车费" prop="otherForkliftExpense">
        <el-input
          v-model="queryParams.otherForkliftExpense"
          placeholder="请输入收取其他叉车费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他费用总额" prop="totalOtherExpenses">
        <el-input
          v-model="queryParams.totalOtherExpenses"
          placeholder="请输入其他费用总额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="去程运费" prop="sumOutlogisticsExpenses">
        <el-input
          v-model="queryParams.sumOutlogisticsExpenses"
          placeholder="请输入去程运费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="回程运费" prop="sumInLogisticsExpenses">
        <el-input
          v-model="queryParams.sumInLogisticsExpenses"
          placeholder="请输入回程运费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣其他费用" prop="itemExpense">
        <el-input
          v-model="queryParams.itemExpense"
          placeholder="请输入项目应扣其他费用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣电线" prop="itemWireExpense">
        <el-input
          v-model="queryParams.itemWireExpense"
          placeholder="请输入项目应扣电线"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣水管" prop="itemWaterPipeExpense">
        <el-input
          v-model="queryParams.itemWaterPipeExpense"
          placeholder="请输入项目应扣水管"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣主板" prop="itemMotherboardExpense">
        <el-input
          v-model="queryParams.itemMotherboardExpense"
          placeholder="请输入项目应扣主板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣相序板" prop="itemPlateExpense">
        <el-input
          v-model="queryParams.itemPlateExpense"
          placeholder="请输入项目应扣相序板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣压缩机" prop="itemCompressorExpense">
        <el-input
          v-model="queryParams.itemCompressorExpense"
          placeholder="请输入项目应扣压缩机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣人工费" prop="itemPeopleExpense">
        <el-input
          v-model="queryParams.itemPeopleExpense"
          placeholder="请输入项目应扣人工费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣设备外观损坏" prop="itemEquipmentExpense">
        <el-input
          v-model="queryParams.itemEquipmentExpense"
          placeholder="请输入项目应扣设备外观损坏"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣叉车费" prop="itemForkliftExpense">
        <el-input
          v-model="queryParams.itemForkliftExpense"
          placeholder="请输入项目应扣叉车费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣合计" prop="totalDeductibleExpenses">
        <el-input
          v-model="queryParams.totalDeductibleExpenses"
          placeholder="请输入项目应扣合计"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料物流费" prop="materialLogisticsExpense">
        <el-input
          v-model="queryParams.materialLogisticsExpense"
          placeholder="请输入物料物流费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料维修费" prop="materialRepairExpense">
        <el-input
          v-model="queryParams.materialRepairExpense"
          placeholder="请输入物料维修费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料其他费用" prop="materialExpense">
        <el-input
          v-model="queryParams.materialExpense"
          placeholder="请输入物料其他费用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料电线" prop="materialWireExpense">
        <el-input
          v-model="queryParams.materialWireExpense"
          placeholder="请输入物料电线"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料水管" prop="materialWaterPipeExpense">
        <el-input
          v-model="queryParams.materialWaterPipeExpense"
          placeholder="请输入物料水管"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料主板" prop="materialMotherboardExpense">
        <el-input
          v-model="queryParams.materialMotherboardExpense"
          placeholder="请输入物料主板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料相序板" prop="materialPlateExpense">
        <el-input
          v-model="queryParams.materialPlateExpense"
          placeholder="请输入物料相序板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料压缩机" prop="materialCompressorExpense">
        <el-input
          v-model="queryParams.materialCompressorExpense"
          placeholder="请输入物料压缩机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料人工费" prop="materialPeopleExpense">
        <el-input
          v-model="queryParams.materialPeopleExpense"
          placeholder="请输入物料人工费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料设备外观损坏" prop="materialEquipmentExpense">
        <el-input
          v-model="queryParams.materialEquipmentExpense"
          placeholder="请输入物料设备外观损坏"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料叉车费" prop="materialForkliftExpense">
        <el-input
          v-model="queryParams.materialForkliftExpense"
          placeholder="请输入物料叉车费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物流费用总额" prop="totalLogisticsExpenses">
        <el-input
          v-model="queryParams.totalLogisticsExpenses"
          placeholder="请输入物流费用总额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件物流费" prop="repairLogisticsExpense">
        <el-input
          v-model="queryParams.repairLogisticsExpense"
          placeholder="请输入维修配件物流费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件维修费" prop="repairRepairExpense">
        <el-input
          v-model="queryParams.repairRepairExpense"
          placeholder="请输入维修配件维修费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件其他费用" prop="repairExpense">
        <el-input
          v-model="queryParams.repairExpense"
          placeholder="请输入维修配件其他费用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件电线" prop="repairWireExpense">
        <el-input
          v-model="queryParams.repairWireExpense"
          placeholder="请输入维修配件电线"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件水管" prop="repairWaterPipeExpense">
        <el-input
          v-model="queryParams.repairWaterPipeExpense"
          placeholder="请输入维修配件水管"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件主板" prop="repairMotherboardExpense">
        <el-input
          v-model="queryParams.repairMotherboardExpense"
          placeholder="请输入维修配件主板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件相序板" prop="repairPlateExpense">
        <el-input
          v-model="queryParams.repairPlateExpense"
          placeholder="请输入维修配件相序板"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件压缩机" prop="repairCompressorExpense">
        <el-input
          v-model="queryParams.repairCompressorExpense"
          placeholder="请输入维修配件压缩机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件人工费" prop="repairPeopleExpense">
        <el-input
          v-model="queryParams.repairPeopleExpense"
          placeholder="请输入维修配件人工费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件设备外观损坏" prop="repairEquipmentExpense">
        <el-input
          v-model="queryParams.repairEquipmentExpense"
          placeholder="请输入维修配件设备外观损坏"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件叉车费" prop="repairForkliftExpense">
        <el-input
          v-model="queryParams.repairForkliftExpense"
          placeholder="请输入维修配件叉车费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维修配件总额" prop="totalMaintenanceCost">
        <el-input
          v-model="queryParams.totalMaintenanceCost"
          placeholder="请输入维修配件总额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目应扣工程费用总额" prop="totalProjectEngineerCost">
        <el-input
          v-model="queryParams.totalProjectEngineerCost"
          placeholder="请输入项目应扣工程费用总额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['module:clearingMarginDetailView:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['module:clearingMarginDetailView:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['module:clearingMarginDetailView:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['module:clearingMarginDetailView:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="clearingMarginDetailViewList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="业务员名称" align="center" prop="salesmanName" />
      <el-table-column label="结算月" align="center" prop="settlementMonth" />
      <el-table-column label="业绩金额" align="center" prop="payAmount" />
      <el-table-column label="结算租金" align="center" prop="rentPaid" />
      <el-table-column label="收取其他物流费" align="center" prop="otherLogisticsExpense" />
      <el-table-column label="收取其他维修费" align="center" prop="otherRepairExpense" />
      <el-table-column label="收取其他其他费用" align="center" prop="otherExpense" />
      <el-table-column label="收取其他电线" align="center" prop="otherWireExpense" />
      <el-table-column label="收取其他水管" align="center" prop="otherWaterPipeExpense" />
      <el-table-column label="收取其他主板" align="center" prop="otherMotherboardExpense" />
      <el-table-column label="收取其他相序板" align="center" prop="otherPlateExpense" />
      <el-table-column label="收取其他压缩机" align="center" prop="otherCompressorExpense" />
      <el-table-column label="收取其他人工费" align="center" prop="otherPeopleExpense" />
      <el-table-column label="收取其他设备外观损坏" align="center" prop="otherEquipmentExpense" />
      <el-table-column label="收取其他叉车费" align="center" prop="otherForkliftExpense" />
      <el-table-column label="其他费用总额" align="center" prop="totalOtherExpenses" />
      <el-table-column label="去程运费" align="center" prop="sumOutlogisticsExpenses" />
      <el-table-column label="回程运费" align="center" prop="sumInLogisticsExpenses" />
      <el-table-column label="项目应扣其他费用" align="center" prop="itemExpense" />
      <el-table-column label="项目应扣电线" align="center" prop="itemWireExpense" />
      <el-table-column label="项目应扣水管" align="center" prop="itemWaterPipeExpense" />
      <el-table-column label="项目应扣主板" align="center" prop="itemMotherboardExpense" />
      <el-table-column label="项目应扣相序板" align="center" prop="itemPlateExpense" />
      <el-table-column label="项目应扣压缩机" align="center" prop="itemCompressorExpense" />
      <el-table-column label="项目应扣人工费" align="center" prop="itemPeopleExpense" />
      <el-table-column label="项目应扣设备外观损坏" align="center" prop="itemEquipmentExpense" />
      <el-table-column label="项目应扣叉车费" align="center" prop="itemForkliftExpense" />
      <el-table-column label="项目应扣合计" align="center" prop="totalDeductibleExpenses" />
      <el-table-column label="物料物流费" align="center" prop="materialLogisticsExpense" />
      <el-table-column label="物料维修费" align="center" prop="materialRepairExpense" />
      <el-table-column label="物料其他费用" align="center" prop="materialExpense" />
      <el-table-column label="物料电线" align="center" prop="materialWireExpense" />
      <el-table-column label="物料水管" align="center" prop="materialWaterPipeExpense" />
      <el-table-column label="物料主板" align="center" prop="materialMotherboardExpense" />
      <el-table-column label="物料相序板" align="center" prop="materialPlateExpense" />
      <el-table-column label="物料压缩机" align="center" prop="materialCompressorExpense" />
      <el-table-column label="物料人工费" align="center" prop="materialPeopleExpense" />
      <el-table-column label="物料设备外观损坏" align="center" prop="materialEquipmentExpense" />
      <el-table-column label="物料叉车费" align="center" prop="materialForkliftExpense" />
      <el-table-column label="物流费用总额" align="center" prop="totalLogisticsExpenses" />
      <el-table-column label="维修配件物流费" align="center" prop="repairLogisticsExpense" />
      <el-table-column label="维修配件维修费" align="center" prop="repairRepairExpense" />
      <el-table-column label="维修配件其他费用" align="center" prop="repairExpense" />
      <el-table-column label="维修配件电线" align="center" prop="repairWireExpense" />
      <el-table-column label="维修配件水管" align="center" prop="repairWaterPipeExpense" />
      <el-table-column label="维修配件主板" align="center" prop="repairMotherboardExpense" />
      <el-table-column label="维修配件相序板" align="center" prop="repairPlateExpense" />
      <el-table-column label="维修配件压缩机" align="center" prop="repairCompressorExpense" />
      <el-table-column label="维修配件人工费" align="center" prop="repairPeopleExpense" />
      <el-table-column label="维修配件设备外观损坏" align="center" prop="repairEquipmentExpense" />
      <el-table-column label="维修配件叉车费" align="center" prop="repairForkliftExpense" />
      <el-table-column label="维修配件总额" align="center" prop="totalMaintenanceCost" />
      <el-table-column label="项目应扣工程费用总额" align="center" prop="totalProjectEngineerCost" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['module:clearingMarginDetailView:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['module:clearingMarginDetailView:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改VIEW对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="业务员名称" prop="salesmanName">
          <el-input v-model="form.salesmanName" placeholder="请输入业务员名称" />
        </el-form-item>
        <el-form-item label="结算月" prop="settlementMonth">
          <el-input v-model="form.settlementMonth" placeholder="请输入结算月" />
        </el-form-item>
        <el-form-item label="业绩金额" prop="payAmount">
          <el-input v-model="form.payAmount" placeholder="请输入业绩金额" />
        </el-form-item>
        <el-form-item label="结算租金" prop="rentPaid">
          <el-input v-model="form.rentPaid" placeholder="请输入结算租金" />
        </el-form-item>
        <el-form-item label="收取其他物流费" prop="otherLogisticsExpense">
          <el-input v-model="form.otherLogisticsExpense" placeholder="请输入收取其他物流费" />
        </el-form-item>
        <el-form-item label="收取其他维修费" prop="otherRepairExpense">
          <el-input v-model="form.otherRepairExpense" placeholder="请输入收取其他维修费" />
        </el-form-item>
        <el-form-item label="收取其他其他费用" prop="otherExpense">
          <el-input v-model="form.otherExpense" placeholder="请输入收取其他其他费用" />
        </el-form-item>
        <el-form-item label="收取其他电线" prop="otherWireExpense">
          <el-input v-model="form.otherWireExpense" placeholder="请输入收取其他电线" />
        </el-form-item>
        <el-form-item label="收取其他水管" prop="otherWaterPipeExpense">
          <el-input v-model="form.otherWaterPipeExpense" placeholder="请输入收取其他水管" />
        </el-form-item>
        <el-form-item label="收取其他主板" prop="otherMotherboardExpense">
          <el-input v-model="form.otherMotherboardExpense" placeholder="请输入收取其他主板" />
        </el-form-item>
        <el-form-item label="收取其他相序板" prop="otherPlateExpense">
          <el-input v-model="form.otherPlateExpense" placeholder="请输入收取其他相序板" />
        </el-form-item>
        <el-form-item label="收取其他压缩机" prop="otherCompressorExpense">
          <el-input v-model="form.otherCompressorExpense" placeholder="请输入收取其他压缩机" />
        </el-form-item>
        <el-form-item label="收取其他人工费" prop="otherPeopleExpense">
          <el-input v-model="form.otherPeopleExpense" placeholder="请输入收取其他人工费" />
        </el-form-item>
        <el-form-item label="收取其他设备外观损坏" prop="otherEquipmentExpense">
          <el-input v-model="form.otherEquipmentExpense" placeholder="请输入收取其他设备外观损坏" />
        </el-form-item>
        <el-form-item label="收取其他叉车费" prop="otherForkliftExpense">
          <el-input v-model="form.otherForkliftExpense" placeholder="请输入收取其他叉车费" />
        </el-form-item>
        <el-form-item label="其他费用总额" prop="totalOtherExpenses">
          <el-input v-model="form.totalOtherExpenses" placeholder="请输入其他费用总额" />
        </el-form-item>
        <el-form-item label="去程运费" prop="sumOutlogisticsExpenses">
          <el-input v-model="form.sumOutlogisticsExpenses" placeholder="请输入去程运费" />
        </el-form-item>
        <el-form-item label="回程运费" prop="sumInLogisticsExpenses">
          <el-input v-model="form.sumInLogisticsExpenses" placeholder="请输入回程运费" />
        </el-form-item>
        <el-form-item label="项目应扣其他费用" prop="itemExpense">
          <el-input v-model="form.itemExpense" placeholder="请输入项目应扣其他费用" />
        </el-form-item>
        <el-form-item label="项目应扣电线" prop="itemWireExpense">
          <el-input v-model="form.itemWireExpense" placeholder="请输入项目应扣电线" />
        </el-form-item>
        <el-form-item label="项目应扣水管" prop="itemWaterPipeExpense">
          <el-input v-model="form.itemWaterPipeExpense" placeholder="请输入项目应扣水管" />
        </el-form-item>
        <el-form-item label="项目应扣主板" prop="itemMotherboardExpense">
          <el-input v-model="form.itemMotherboardExpense" placeholder="请输入项目应扣主板" />
        </el-form-item>
        <el-form-item label="项目应扣相序板" prop="itemPlateExpense">
          <el-input v-model="form.itemPlateExpense" placeholder="请输入项目应扣相序板" />
        </el-form-item>
        <el-form-item label="项目应扣压缩机" prop="itemCompressorExpense">
          <el-input v-model="form.itemCompressorExpense" placeholder="请输入项目应扣压缩机" />
        </el-form-item>
        <el-form-item label="项目应扣人工费" prop="itemPeopleExpense">
          <el-input v-model="form.itemPeopleExpense" placeholder="请输入项目应扣人工费" />
        </el-form-item>
        <el-form-item label="项目应扣设备外观损坏" prop="itemEquipmentExpense">
          <el-input v-model="form.itemEquipmentExpense" placeholder="请输入项目应扣设备外观损坏" />
        </el-form-item>
        <el-form-item label="项目应扣叉车费" prop="itemForkliftExpense">
          <el-input v-model="form.itemForkliftExpense" placeholder="请输入项目应扣叉车费" />
        </el-form-item>
        <el-form-item label="项目应扣合计" prop="totalDeductibleExpenses">
          <el-input v-model="form.totalDeductibleExpenses" placeholder="请输入项目应扣合计" />
        </el-form-item>
        <el-form-item label="物料物流费" prop="materialLogisticsExpense">
          <el-input v-model="form.materialLogisticsExpense" placeholder="请输入物料物流费" />
        </el-form-item>
        <el-form-item label="物料维修费" prop="materialRepairExpense">
          <el-input v-model="form.materialRepairExpense" placeholder="请输入物料维修费" />
        </el-form-item>
        <el-form-item label="物料其他费用" prop="materialExpense">
          <el-input v-model="form.materialExpense" placeholder="请输入物料其他费用" />
        </el-form-item>
        <el-form-item label="物料电线" prop="materialWireExpense">
          <el-input v-model="form.materialWireExpense" placeholder="请输入物料电线" />
        </el-form-item>
        <el-form-item label="物料水管" prop="materialWaterPipeExpense">
          <el-input v-model="form.materialWaterPipeExpense" placeholder="请输入物料水管" />
        </el-form-item>
        <el-form-item label="物料主板" prop="materialMotherboardExpense">
          <el-input v-model="form.materialMotherboardExpense" placeholder="请输入物料主板" />
        </el-form-item>
        <el-form-item label="物料相序板" prop="materialPlateExpense">
          <el-input v-model="form.materialPlateExpense" placeholder="请输入物料相序板" />
        </el-form-item>
        <el-form-item label="物料压缩机" prop="materialCompressorExpense">
          <el-input v-model="form.materialCompressorExpense" placeholder="请输入物料压缩机" />
        </el-form-item>
        <el-form-item label="物料人工费" prop="materialPeopleExpense">
          <el-input v-model="form.materialPeopleExpense" placeholder="请输入物料人工费" />
        </el-form-item>
        <el-form-item label="物料设备外观损坏" prop="materialEquipmentExpense">
          <el-input v-model="form.materialEquipmentExpense" placeholder="请输入物料设备外观损坏" />
        </el-form-item>
        <el-form-item label="物料叉车费" prop="materialForkliftExpense">
          <el-input v-model="form.materialForkliftExpense" placeholder="请输入物料叉车费" />
        </el-form-item>
        <el-form-item label="物流费用总额" prop="totalLogisticsExpenses">
          <el-input v-model="form.totalLogisticsExpenses" placeholder="请输入物流费用总额" />
        </el-form-item>
        <el-form-item label="维修配件物流费" prop="repairLogisticsExpense">
          <el-input v-model="form.repairLogisticsExpense" placeholder="请输入维修配件物流费" />
        </el-form-item>
        <el-form-item label="维修配件维修费" prop="repairRepairExpense">
          <el-input v-model="form.repairRepairExpense" placeholder="请输入维修配件维修费" />
        </el-form-item>
        <el-form-item label="维修配件其他费用" prop="repairExpense">
          <el-input v-model="form.repairExpense" placeholder="请输入维修配件其他费用" />
        </el-form-item>
        <el-form-item label="维修配件电线" prop="repairWireExpense">
          <el-input v-model="form.repairWireExpense" placeholder="请输入维修配件电线" />
        </el-form-item>
        <el-form-item label="维修配件水管" prop="repairWaterPipeExpense">
          <el-input v-model="form.repairWaterPipeExpense" placeholder="请输入维修配件水管" />
        </el-form-item>
        <el-form-item label="维修配件主板" prop="repairMotherboardExpense">
          <el-input v-model="form.repairMotherboardExpense" placeholder="请输入维修配件主板" />
        </el-form-item>
        <el-form-item label="维修配件相序板" prop="repairPlateExpense">
          <el-input v-model="form.repairPlateExpense" placeholder="请输入维修配件相序板" />
        </el-form-item>
        <el-form-item label="维修配件压缩机" prop="repairCompressorExpense">
          <el-input v-model="form.repairCompressorExpense" placeholder="请输入维修配件压缩机" />
        </el-form-item>
        <el-form-item label="维修配件人工费" prop="repairPeopleExpense">
          <el-input v-model="form.repairPeopleExpense" placeholder="请输入维修配件人工费" />
        </el-form-item>
        <el-form-item label="维修配件设备外观损坏" prop="repairEquipmentExpense">
          <el-input v-model="form.repairEquipmentExpense" placeholder="请输入维修配件设备外观损坏" />
        </el-form-item>
        <el-form-item label="维修配件叉车费" prop="repairForkliftExpense">
          <el-input v-model="form.repairForkliftExpense" placeholder="请输入维修配件叉车费" />
        </el-form-item>
        <el-form-item label="维修配件总额" prop="totalMaintenanceCost">
          <el-input v-model="form.totalMaintenanceCost" placeholder="请输入维修配件总额" />
        </el-form-item>
        <el-form-item label="项目应扣工程费用总额" prop="totalProjectEngineerCost">
          <el-input v-model="form.totalProjectEngineerCost" placeholder="请输入项目应扣工程费用总额" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listClearingMarginDetailView, getClearingMarginDetailView, delClearingMarginDetailView, addClearingMarginDetailView, updateClearingMarginDetailView } from "@/api/module/clearingMarginDetailView";

export default {
  name: "ClearingMarginDetailView",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // VIEW表格数据
      clearingMarginDetailViewList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        salesmanName: null,
        settlementMonth: null,
        payAmount: null,
        rentPaid: null,
        otherLogisticsExpense: null,
        otherRepairExpense: null,
        otherExpense: null,
        otherWireExpense: null,
        otherWaterPipeExpense: null,
        otherMotherboardExpense: null,
        otherPlateExpense: null,
        otherCompressorExpense: null,
        otherPeopleExpense: null,
        otherEquipmentExpense: null,
        otherForkliftExpense: null,
        totalOtherExpenses: null,
        sumOutlogisticsExpenses: null,
        sumInLogisticsExpenses: null,
        itemExpense: null,
        itemWireExpense: null,
        itemWaterPipeExpense: null,
        itemMotherboardExpense: null,
        itemPlateExpense: null,
        itemCompressorExpense: null,
        itemPeopleExpense: null,
        itemEquipmentExpense: null,
        itemForkliftExpense: null,
        totalDeductibleExpenses: null,
        materialLogisticsExpense: null,
        materialRepairExpense: null,
        materialExpense: null,
        materialWireExpense: null,
        materialWaterPipeExpense: null,
        materialMotherboardExpense: null,
        materialPlateExpense: null,
        materialCompressorExpense: null,
        materialPeopleExpense: null,
        materialEquipmentExpense: null,
        materialForkliftExpense: null,
        totalLogisticsExpenses: null,
        repairLogisticsExpense: null,
        repairRepairExpense: null,
        repairExpense: null,
        repairWireExpense: null,
        repairWaterPipeExpense: null,
        repairMotherboardExpense: null,
        repairPlateExpense: null,
        repairCompressorExpense: null,
        repairPeopleExpense: null,
        repairEquipmentExpense: null,
        repairForkliftExpense: null,
        totalMaintenanceCost: null,
        totalProjectEngineerCost: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询VIEW列表 */
    getList() {
      this.loading = true;
      listClearingMarginDetailView(this.queryParams).then(response => {
        this.clearingMarginDetailViewList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        salesmanName: null,
        settlementMonth: null,
        payAmount: null,
        rentPaid: null,
        otherLogisticsExpense: null,
        otherRepairExpense: null,
        otherExpense: null,
        otherWireExpense: null,
        otherWaterPipeExpense: null,
        otherMotherboardExpense: null,
        otherPlateExpense: null,
        otherCompressorExpense: null,
        otherPeopleExpense: null,
        otherEquipmentExpense: null,
        otherForkliftExpense: null,
        totalOtherExpenses: null,
        sumOutlogisticsExpenses: null,
        sumInLogisticsExpenses: null,
        itemExpense: null,
        itemWireExpense: null,
        itemWaterPipeExpense: null,
        itemMotherboardExpense: null,
        itemPlateExpense: null,
        itemCompressorExpense: null,
        itemPeopleExpense: null,
        itemEquipmentExpense: null,
        itemForkliftExpense: null,
        totalDeductibleExpenses: null,
        materialLogisticsExpense: null,
        materialRepairExpense: null,
        materialExpense: null,
        materialWireExpense: null,
        materialWaterPipeExpense: null,
        materialMotherboardExpense: null,
        materialPlateExpense: null,
        materialCompressorExpense: null,
        materialPeopleExpense: null,
        materialEquipmentExpense: null,
        materialForkliftExpense: null,
        totalLogisticsExpenses: null,
        repairLogisticsExpense: null,
        repairRepairExpense: null,
        repairExpense: null,
        repairWireExpense: null,
        repairWaterPipeExpense: null,
        repairMotherboardExpense: null,
        repairPlateExpense: null,
        repairCompressorExpense: null,
        repairPeopleExpense: null,
        repairEquipmentExpense: null,
        repairForkliftExpense: null,
        totalMaintenanceCost: null,
        totalProjectEngineerCost: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.salesmanName)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加VIEW";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const salesmanName = row.salesmanName || this.ids
      getClearingMarginDetailView(salesmanName).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改VIEW";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.salesmanName != null) {
            updateClearingMarginDetailView(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addClearingMarginDetailView(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const salesmanNames = row.salesmanName || this.ids;
      this.$modal.confirm('是否确认删除VIEW编号为"' + salesmanNames + '"的数据项？').then(function() {
        return delClearingMarginDetailView(salesmanNames);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('module/clearingMarginDetailView/export', {
        ...this.queryParams
      }, `clearingMarginDetailView_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
